home *** CD-ROM | disk | FTP | other *** search
/ Macworld Expo - Develope…Central & Net Innovations / Developer Central and Net Innovators (MacWorld Expo) (January 1999).iso / Developer Central / Bowers Development / Demo AppMaker / Examples / Pascal OS8 / Gadgets / GadgetsEngine.p < prev    next >
Encoding:
Text File  |  1998-10-30  |  2.1 KB  |  116 lines  |  [TEXT/CWIE]

  1. { GadgetsEngine.p -- application-specific data management }
  2. { Created 10/30/98 1:04 PM by AppMaker }
  3.  
  4. { This module contains data structures to access the data in your }
  5. { document's file(s). The purpose is to isolate the details of the }
  6. { data representation into this module and to provide accessor }
  7. { functions for reading/writing logical pieces of the data. }
  8. { For your application, you will probably rewrite most of this. }
  9. { This module will not be regenerated by AppMaker unless you delete it. }
  10.  
  11. Unit GadgetsEngine;
  12. Interface
  13.  
  14. Uses
  15.     Types,
  16.     Quickdraw,
  17.     Controls,
  18.     Events,
  19.     Files,
  20.     Lists,
  21.     Menus,
  22.     DDocData,
  23.     TextEdit,
  24.     AMEngine;
  25.  
  26. const
  27.     kSignature        = 'XXXX';
  28.     kFileType        = 'TEXT';
  29.  
  30. type
  31.     GadgetsEngine        = object (AMEngine)
  32.  
  33.     {data members}
  34.  
  35.     {methods - public}
  36.         Procedure Initialize; Override;
  37.  
  38.         Function  GetDocData: DDocData;
  39.  
  40.     {methods - internal}
  41.         Procedure InitData; Override;
  42.         Procedure DisposeData; Override;
  43.         Procedure ReadFile; Override;
  44.         Procedure WriteFile; Override;
  45.     end;
  46.  
  47. {----------}
  48. Function NewGadgetsEngine: GadgetsEngine;
  49.  
  50. {----------}
  51. Implementation
  52.  
  53. Uses
  54.     Globals,
  55.     Miscellany;
  56.  
  57. {----------}
  58. Function NewGadgetsEngine: GadgetsEngine;
  59. var
  60.     engine:        GadgetsEngine;
  61. begin
  62.     New (engine);
  63.     if engine <> nil then begin
  64.         engine.Initialize;
  65.     end;
  66.     NewGadgetsEngine := engine;
  67. end;
  68.  
  69. {----------}
  70. Procedure GadgetsEngine.Initialize;
  71. begin
  72.     inherited Initialize;
  73.  
  74.     mFileType := kFiletype;
  75.     mSignature := kSignature;
  76. end;
  77.  
  78. { These are just models for your own data access functions. }
  79. { Replace them with ones that do something useful. }
  80.  
  81. {----------}
  82. Function GadgetsEngine.GetDocData: DDocData;
  83. begin
  84.     GetDocData := NewDDocData;
  85. end;
  86.  
  87.  
  88. {----------}
  89. Procedure GadgetsEngine.InitData;
  90. begin
  91.     {override to initialize your data structures}
  92. end;
  93.  
  94. {----------}
  95. Procedure GadgetsEngine.DisposeData;
  96. begin
  97.     {override to dispose your data structures}
  98. end;
  99.  
  100. {----------}
  101. Procedure GadgetsEngine.ReadFile;
  102. begin
  103.     InitData;
  104.     mDirty := false;
  105.     {override to read from the current file into your data structures}
  106. end;
  107.  
  108. {----------}
  109. Procedure GadgetsEngine.WriteFile;
  110. begin
  111.     mDirty := false;
  112.     {override to write your data structures to the current file}
  113. end;
  114.  
  115. end.
  116.